<template>
	<!-- <view class="product" style="width: 750rpx;position: relative;height: 90vh;overflow: auto;"> -->
	<view class="product product-index" style="width: 750rpx;position: relative;">
		<!-- 顶部导航栏 -->
		<view class="tab-bar flex-row" style="width: 750rpx;position: sticky;top: 0;
											  left: 0;z-index: 9999;
											  background-color: rgba(255, 255, 255, .7);
											  backdrop-filter: blur(15px);
											  -webkit-backdrop-filter: blur(15px);">
			<!-- 三个导航按钮 -->
			<view class="tab-bar-body flex-row-around" style="width: 650rpx;height: 30px;">
				<view :class="{'tab-bar-item': 1===1, 'tab-bar-item-active': tabStatus===1}" @click="tabChange(1)">
					释镜型号
				</view>
				<view :class="{'tab-bar-item': 1===1, 'tab-bar-item-active': tabStatus===2}" @click="tabChange(2)">
					释镜金身
				</view>
				<view :class="{'tab-bar-item': 1===1, 'tab-bar-item-active': tabStatus===3}" @click="tabChange(3)">
					般若之声
				</view>
			</view>
			<!-- 搜索按钮 -->
<!-- 			<view class="tab-bar-search" style="width: 100rpx;height: 30px;" v-if="tabStatus===1">
				<view class="search-icon">
					<uni-icons
						type="settings" 
						size="30"
						@click="toggle('right')">
					</uni-icons>
				</view>
			</view> -->
		</view>
		<!-- 页面主体 -->
		<!-- 加载动画 -->
		<view class="loading" style="position: relative; width: 750rpx;height: 100vh;text-align: center;" v-if="isLoading">
			<view class="text position-center" style="width: 750rpx;">
				{{ loadingTitle }}
			</view>
		</view>
		<!-- 设备产品 -->
		<view class="device-product product-body" v-if="tabStatus===1 && !isLoading">
			<view class="top-switch" @click="toggle('right')"
				  style="width: 700rpx;height: 30px;
					     display: flex;justify-content: flex-end;
						 align-items: center;margin-bottom: 10px;">
				<view class="top-switch-label" 
					  style="font-size: 14px;font-weight: bold;color: #aaa;">
					筛选
				</view>
				<view class="top-switch-search-icon">
					<uni-icons
						type="settings" 
						size="18"
						>
					</uni-icons>
				</view>
			</view>
			<!-- 列表区域 -->
			<view class="product-list flex-row-graid" style="width: 100%;">
				<view v-for="item in productList" :key="item.id" @click="checkDetails(item.advProductsId)">
					<view class="product-list-item" style="width: 330rpx;height: 225px;margin-bottom: 15px;
														position: relative;box-shadow: 0 0 10px 0 #ccc;
														border-radius: 10px;overflow: hidden;">
						<!-- 大图 -->
						<view class="product-list-item-bigimg" style="width: 100%;height: 160px;">
							<image :src="baseUrl+item.productImage" style="width: 100%;height: 100%;"></image>
						</view>
						<!-- 产品信息 -->
						<view class="product-list-item-info">
							<view class="info-title flex-column-around" style="width: 100%;height: 40px;text-align: center;padding: 5px 0;box-sizing: border-box;">
								<text>{{ item.productName }}</text>
							</view>
							<view class="info-product" style="width: 100%;height: 20px;display: flex;
															  justify-content: start;align-items: center;line-height: 20px;">
								<text style="color: orangered;margin-left: 10px;">
									￥ {{ item.productPrice }}
								</text>
							</view>
						</view>
					</view>
				</view>
			</view>

		</view>
		<!-- 内容产品 -->
		<view class="vedio-product product-body" v-if="tabStatus===2 && !isLoading">
			<!-- 列表区域 -->
			<view class="product-list flex-row-graid" style="width: 100%;">
				<view v-for="item in productList" :key="item.id"  @click="checkDetails(item.advProductsId)">
					<view class="product-list-item" style="width: 330rpx;height: 225px;margin-bottom: 15px;
														position: relative;box-shadow: 0 0 10px 0 #ccc;
														border-radius: 10px;overflow: hidden;">
						<!-- 大图 -->
						<view class="product-list-item-bigimg" style="width: 100%;height: 160px;position: relative;">
							<image :src="baseUrl+item.productImage" style="width: 100%;height: 100%;"></image>
							<!-- 播放按钮 -->
							<view class="play-icon" style="position: absolute;
														   left: 50%;top: 50%;
														   transform: translate(-50%,-50%);">
								<uni-icons
									type="download" 
									size="30"></uni-icons>
							</view>
						</view>
						<!-- 产品信息 -->
						<view class="product-list-item-info">
							<view class="info-title flex-column-around" style="width: 100%;height: 40px;text-align: center;padding: 5px 0;box-sizing: border-box;">
								<text>{{ item.productName }}</text>
							</view>
							<view class="info-product" style="width: 100%;height: 20px;display: flex;
															  justify-content: start;align-items: center;line-height: 20px;">
								<text style="color: orangered;margin-left: 10px;">
									￥ {{ item.productPrice }}
								</text>
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 已购产品(现为班诺之声) -->
		<view class="vedio-buy product-body" v-if="tabStatus===3 && !isLoading">
			<!-- 已购设备产品 -->
			<view class="title">
				已购设备
			</view>
			<view class="buy-device" style="position: relative; box-sizing: border-box; width: 700rpx;height: 80px;margin: 0 auto;">
				<view class="buy-device-body position-center" style="box-sizing: border-box; 
														width: 700rpx; background-color: #eee;
														height: 60px; border-radius: 5px;
														box-shadow: 0 0 10px 0 #eee;">
					<view class="buy-device-select position-center"
						  style="width: 600rpx;
								 font-size: 20px;">
						<uni-data-select
							v-model="deviceChoseValue"
							:localdata="deviceList"
							@change="deviceChange"
							placeholder="请选择设备"
							emptyTips="暂无设备"
							:clear="false"
						></uni-data-select>
					</view>
				</view>
			</view>
			<view class="title">
				般若之声
			</view>
			<view class="information" 
				  style="box-sizing: border-box; width: 750rpx;padding: 0 2.5px;">
				<!-- 资讯 列表 -->
				<view class="active-list"
					  style="width: 700rpx;">
					<view v-for="item in data" :key="item.advPlatinfosId">
						<!-- 列表项 -->
						<view class="active-list-item flex-row"  @click="checkInfo(item.advPlatinfosId)"
							  style="box-sizing: border-box; width: 100%;height: 100px;
							         border: 2px solid #aaa;margin: 10px 0 0 0;
									 border-radius: 10px 10px 0 0;">
							<!-- 左边图片 -->
							<view class="active-list-item-image" style="width: 100px;height: 80px;">
								<image :src="baseUrl+item.photoimage" style="width: 80px;height: 80px;"></image>
							</view>
							<!-- 右边内容 -->
							<view class="active-list-item-right flex-column" style="flex: 1; height: 80px; align-items: flex-start;">
								<!-- 标题 -->
								<view class="item-right-content" style="height: 60px; font-weight: 550;">
									{{item.title}}
								</view>
								<!-- 底部 -->
								<view class="item-right-bottom flex-row" style="width: 100%; height: 20px; font-size: 12px;color: #aaa;">
									<!-- 浏览量-->
									<!-- <view class="bottom-read">
										<text class="bottom-read-text">浏览量 1314</text>
									</view> -->
									<!-- 时间-->
									<view class="bottom-data">
										<text class="bottom-data-good">
											{{formatDateTime(item.pubDatetime)}}
										</text>
									</view>
								</view>
							</view>
						</view>
						<view class="status-btn" v-if="deviceChoseValue"
							  style="width: 100%;height: 40px;background-color: #ccc;
									 border-radius: 0 0 10px 10px;
									 box-shadow: inset 0 0 10px 0 #aaa;
									 display: flex;justify-content: space-around;
									 align-items: center;">
							<view v-if="item.isChooseaudio!=1 && item.syncFlag==1" class="is-default status-btn-item" @click="changeVoice('chooseaudio', item)">
								设为默认
							</view>
							<view v-if="item.isChooseaudio==1 && item.syncFlag==1" class="is-default status-btn-item-no">
								默认音频
							</view>
							<view class="is-sync status-btn-item" @click="changeVoice('sync', item)">
								{{item.syncFlag==1?'取消同步':'同步到设备'}}
							</view>
							<view class="is-circulate status-btn-item" @click="changeVoice('cycle', item)" v-if="item.syncFlag==1">
								循环播放-{{item.isCycle==1?'是':'否'}}
							</view>
						</view>
					</view>
				</view>
			</view>
			<view v-if="isGetMore" class="bottom-notice" style="box-sizing: border-box;width: 750rpx;height: 40px;">
				<view class="text" style="box-sizing: border-box; width: 700rpx;height: 20px;margin: 10px auto;
										  line-height: 20px;font-weight: bold;
										  text-align: center;">
					{{bottomNotice}}
				</view>
			</view>
		</view>
		<view>
			<!-- 普通弹窗 -->
			<uni-popup ref="popup" @change="change">
				<view class="popup-content"
					  style="box-sizing: border-box; width: 550rpx;height: 90vh;
							 background-color: #eee;
						     margin-top: 35px;border-radius: 10px 0 0 10px;
							 overflow: auto;">
					<view class="popup-chose-item">
						<view class="popup-title">
							- 颜色 -
						</view>
						<view class="popup-chose-type">
							<view class="popup-chose-type-item"
								  :class="{'chose-color' : item.dictValue==choseColor}"
								  @click="choseChage('color', item)"
								  v-for="item in colorList" :key="item.dictCode">
								{{item.dictLabel}}
							</view>
						</view>
					</view>
					<view class="popup-chose-item">
						<view class="popup-title">
							- 材质 -
						</view>
						<view class="popup-chose-type">
							<view class="popup-chose-type-item"
								  :class="{'chose-materail' : item.dictValue==choseMaterial}"
								  @click="choseChage('material', item)"
								  v-for="item in materialList" :key="item.dictCode">
								{{item.dictLabel}}
							</view>
						</view>
					</view>
					<view class="popup-submit"
						  style="width: 500rpx;height: 40px;
								 margin: 10px auto;display: flex;align-items: center;
								 justify-content: center;">
						<view class="reset-btn"
							  @click="resetChose"
							  style="width: 50%;height: 40px;
								     border-radius: 8px 0 0 8px;background-color: #ccc;
									 text-align: center;font-weight: bold;
									 line-height: 40px;">
							重置
						</view>
						<view class="submit-btn"
							  @click="submitChose"
							  style="width: 50%;height: 40px;
								     border-radius: 0 8px 8px 0;background-color: black;
									 text-align: center;font-weight: bold;color: white;
									 line-height: 40px;">
							确定
						</view>
					</view>
		<!-- 			<view class="popup-submit"
						  style="width: 450rpx;height: 40px;
								 margin: 10px auto;">
						<view class="submit-btn"
							  @click="submitChose"
							  style="width: 100%;height: 40px;
								     border-radius: 8px;background-color: white;
									 box-shadow: 3px 3px 0 0 black;
									 text-align: center;font-weight: bold;
									 line-height: 40px;">
							确定
						</view>
					</view>
					<view class="popup-submit"
						  style="width: 450rpx;height: 40px;
								 margin: 10px auto;">
						<view class="submit-btn"
							  @click="resetChose"
							  style="width: 100%;height: 40px;
								     border-radius: 8px;background-color: white;
									 box-shadow: 3px 3px 0 0 black;
									 text-align: center;font-weight: bold;
									 line-height: 40px;">
							重置
						</view>
					</view> -->
				</view>
			</uni-popup>
		</view>
	</view>
	<!-- <custom-tabbar></custom-tabbar> -->
</template>

<script>
	import { loginSystem } from '/api/login.js'
	import { BASE_URL, BASE_IMAGE_URL, GET_USER_INFO } from '/utils/CommonValues.js'
	import request from '../../utils/request';
	export default {
		data() {
			return {
				choseColor: 0,
				choseMaterial: 0,
				colorList: [], 
				materialList: [],
				type: 'center',
				deviceChoseValue: '',
				deviceList: [
					{value: 1, text:'张三1'}
				],
				defaultVideoProduct: {},
				userInfo: {},
				loadingTitle: '加载中...',
				isLoading: false, // 是否正在加载
				baseUrl: '',
				canUpload: false, // 已购内容中, 是否可以上传
				checkBox: [], // 被选中的列表 id
				tabStatus: 1,
				queryPramas: {
					productType: 1,
					pageNum: 1,
					pageSize: 10,
					reasonable: false
				},
				allOrUpload: true, // 已上传 / 全部
				productList:[],
				buyList: [],
				pageSize: 10, // 取的数据长度
				pageNum: 1, // 取的数据页数
				
				token: '',
				type: '5', // 查看的资讯类型
				data: [], // 班若之声数据
				bottomNotice: '加载更多中...',
				isGetMore: false, // 是否在加载更多
			}
		},
		onReachBottom() {
			console.log("已经到达底部了")
			// 到达底部重新继续加载数据
			if(this.tabStatus == '1' || this.tabStatus == '2') {
				this.getList();
			}
			if(this.tabStatus == '3') {
				if(this.deviceChoseValue) {
					this.getVoiceByDevicesNo(this.deviceChoseValue);
				} else {
					loginSystem().then(data => {
						this.token = data;
						this.getActive();
					})
				}
			}
		},
		onLoad() {
			this.baseUrl = BASE_IMAGE_URL;
			this.getList();
			GET_USER_INFO().then(res => {
				this.userInfo = res;
			})
		},
		methods: {
			// 重置筛选条件
			resetChose() {
				this.choseColor = '';
				this.choseMaterial = '';
				this.queryPramas.color = '';
				this.queryPramas.material = '';
				this.queryPramas.pageNum = 1;
				// this.getList();
			},
			// 根据筛选进行查询
			submitChose() {
				this.productList = [];
				this.queryPramas.pageNum = 1;
				this.getList();
				this.$refs.popup.close();
			},
			choseChage(type, item) {
				switch(type) {
					case 'color': 
						this.choseColor = item.dictValue
						break;
					case 'material': 
						this.choseMaterial = item.dictValue
						console.log(type)
						break;
				}
			},
			change(e) {
				console.log('当前模式：' + e.type + ',状态：' + e.show);
			},
			toggle(type) {
				// 弹出框的时候查询颜色以及材质的信息
				request.GET(`/system/products/findcolor`, null)
					   .then(response => {
						   console.log("颜色信息", response)
						   this.colorList = response.data
						   request.GET(`/system/products/findmaterail`, null)
						   	   .then(response => {
						   		   console.log("材质信息", response)
						   		   this.materialList = response.data
						   	   })
					   })
				this.type = type
				// open 方法传入参数 等同在 uni-popup 组件上绑定 type属性
				this.$refs.popup.open(type)
			},
			// 更改班若之声的状态
			changeVoice(label, item) {
				console.log(item)
				item.isSync = item.isSync==1?1:0;
				item.isChooseaudio = item.isChooseaudio==1?1:0;
				item.isCycle = item.isCycle==1?1:0;
				switch(label) {
					case 'chooseaudio': 
						// 默认
						request.PUT('/system/devicerelation/updateVoice', {
							advMembersId: this.userInfo.advMembersId,
							devicesno: this.deviceChoseValue,
							advPlatinfosId: item.advPlatinfosId,
							isChooseaudio: item.isChooseaudio,
							isCycle: item.isCycle,
							updateLabel: label,
							isSync: item.syncFlag
						}).then(response => {
							console.log(response, "修改默认")
							if(response.statusCode == 200) {
								uni.showToast({
									title: response.message,
									icon: 'none'
								})
								this.pageNum = 1;
								this.data = [];
								this.getVoiceByDevicesNo(this.deviceChoseValue);
							}
						})
						break;
					case 'sync': 
						console.log("修改同步")
						uni.showModal({
							title: '提示',
							content: '需要10秒钟左右才能同步到设备，请耐心等待',
							success() {
								console.log("提示")
							}
						})
						// 同步
						request.PUT('/system/devicerelation/updateVoice', {
							advMembersId: this.userInfo.advMembersId,
							devicesno: this.deviceChoseValue,
							advPlatinfosId: item.advPlatinfosId,
							isChooseaudio: item.isChooseaudio,
							isCycle: item.isCycle,
							updateLabel: label,
							isSync: item.syncFlag
						}).then(response => {
							console.log(response, "修改同步")
							if(response.statusCode == 200) {
								uni.showToast({
									title: response.message,
									icon: 'none'
								})
								this.pageNum = 1;
								this.data = [];
								this.getVoiceByDevicesNo(this.deviceChoseValue);
							}
						})
						break;
					case 'cycle': 
						console.log("修改循环")
						// 循环播放
						request.PUT('/system/devicerelation/updateVoice', {
							advMembersId: this.userInfo.advMembersId,
							devicesno: this.deviceChoseValue,
							advPlatinfosId: item.advPlatinfosId,
							isChooseaudio: item.isChooseaudio,
							isCycle: item.isCycle,
							updateLabel: label,
							isSync: item.syncFlag
						}).then(response => {
							console.log(response, "修改循环")
							if(response.statusCode == 200) {
								uni.showToast({
									title: response.message,
									icon: 'none'
								})
								this.pageNum = 1;
								this.data = [];
								this.getVoiceByDevicesNo(this.deviceChoseValue);
							} 
						})
						break;
				}
			},
			// 根据设备编号查询班若只是
			getVoiceByDevicesNo(value) {
				if(this.pageNum > 1) {
					this.isGetMore = true;
				}
				console.log(this.pageNum, "页码", this.pageSize, "大小")
				request.GET(`/system/platinfos/list/voice/${this.userInfo.advMembersId}/${value}`, {
					pageNum: this.pageNum,
					pageSize: this.pageSize,
					reasonable: false
				}).then(response => {
				    console.log("同步数据", response)
					var rows = response.rows;
					// 去重
					rows.filter((item) => {
						var isOk = true;
						this.data.filter((i) => {
							if(i.advPlatinfosId == item.advPlatinfosId){
								isOk = false;
							}
						})
						if(isOk) {
							this.data.push(item);
						}
					})
				    // this.data.push(...response.rows);
				    this.pageNum = +this.pageNum + 1;
				    this.isGetMore = false;
			    })
			},
			// 获取设备编号
			getDeviceno() {
				request.GET(`/system/inoutstock/getdeviceno/${this.userInfo.advMembersId}`, null)
					   .then(response => {
						   console.log(response, "设备数据")
						   const data = response.data;
						   this.deviceList = data.map(item => {
							   return {
								   value: item.devicesno,
								   text: item.productName + '-' + item.productModel + '-' + item.devicesno
							   }
						   })
					   })
			},
			// 已购设备数据改变
			deviceChange(e) {
				// 更换了设备要重置数据
				this.pageNum = 1;
				this.data = [];
				this.deviceChoseValue = e;
				console.log("设备", e)
				this.getVoiceByDevicesNo(e);
			},
			formatDateTime(isoString) {
			  return isoString.replace('T', '  ')
			},
			// 设置默认播放的视屏
			updateDefault(item) {
				console.log("默认播放", item, this.deviceChoseValue);
				if(!this.deviceChoseValue) {
					uni.showToast({
						title: '请先选择设备',
						icon: 'none'
					})
				} else {
					uni.showModal({
						content: `设置内容[${item.productName}]为设备[${this.deviceChoseValue}]的默认播放设备?`,
						confirmText: '是',
						success: (e) => {
							if(e.confirm) {
								const params = {
									devicesno: this.deviceChoseValue,
									advProductsId: item.advProductsId
								}
								request.PUT('/system/devicerelation/change/default', params)
									   .then(response => {
										   console.log(response);
										   uni.showToast({
										   	 title: response.message,
										   	 icon: 'none'
										   })
										   this.getBuyDevicesno();
									   })
							}
						}
					})
				}
			},
			// 根据设备获取默认的播放视频
			getDefaultVideo() {
				request.GET(`/system/devicerelation/list`, {
					advMembersId: this.userInfo.advMembersId,
					devicesno: this.deviceChoseValue,
					isChoosevideo: 1
				}).then(resposne => {
					console.log(resposne, "默认设备");
					if(resposne.rows.length != 0) {
						this.defaultVideoProduct = resposne.rows[0];
					} else {
						this.defaultVideoProduct = {};
					}
				})
			},
			// 根据设备编号获取内容产品
			getBuyDevicesno() {
				request.GET(`/system/products/findbuy/withdevicesno/${this.deviceChoseValue}/${this.userInfo.advMembersId}`)
					   .then(response => {
						   console.log(response, "根据设备编号获取的产品")
						   this.buyList = [];
						   this.buyList = response.rows;
						   this.updateCheckBox(this.buyList);
						   this.getDefaultVideo();
					   })
			},
			// 传入值, 改变checkBox的值
			updateCheckBox(values) {
				console.log(values)
				var check = [];
				for(var i = 0; i < values.length; i++) {
					if(values[i].syncFlag == 1) {
						check.push(values[i].advProductsId)
					}
				}
				this.checkBox = check;
			},
			// 同步产品到设备
			syncProductDevice() {
				if(this.checkBox.length == 0) {
					uni.showModal({
						title: '检测到你未勾选内容, 是否清空上传内容',
						confirmText: '是',
						success: (e) => {
							if(e.confirm) {
								// if(!this.canUpload) {
								// 	this.checkBox.push("91919191"); // 防止数组为空访问不到接口、
								// }
								request.PUT(`/system/devicerelation/syncdevices`, {
									advMembersId: this.userInfo.advMembersId,
									devicesno: this.deviceChoseValue,
									productsIds: this.checkBox
								}).then(res => {
								    uni.showToast({
									   title: res.message,
									   icon: 'none'
								    })
								    this.getBuyDevicesno();
								})
							}
						}
					})
				} else {
					request.PUT(`/system/devicerelation/syncdevices`, {
						advMembersId: this.userInfo.advMembersId,
						devicesno: this.deviceChoseValue,
						productsIds: this.checkBox
					}).then(res => {
					    uni.showToast({
						   title: res.message,
						   icon: 'none'
					    })
					    this.getBuyDevicesno();
					})
				}
			},
			// 同步内容产品 废弃
			syncProduct() {
				if(this.checkBox.length == 0) {
					uni.showModal({
						title: '检测到你未勾选内容, 是否清空上传内容',
						confirmText: '是',
						success: (e) => {
							if(e.confirm) {
								if(!this.canUpload) {
									this.checkBox.push("91919191"); // 防止数组为空访问不到接口、
								}
								request.POST(`/system/ordersdetail/sync/${this.userInfo.advMembersId}/${this.checkBox}`)
									   .then(res => {
										   uni.showToast({
										   	title: res.message,
											icon: 'none'
										   })
										   this.findBuy();
									   })
							}
						}
					})
				} else {
					request.POST(`/system/ordersdetail/sync/${this.userInfo.advMembersId}/${this.checkBox}`)
						   .then(res => {
							   uni.showToast({
							   	title: res.message,
								icon: 'none'
							   })
							   this.findBuy();
						   })
				}
			},
			// 获取初始化数据
			getList() {
				if(this.queryPramas.pageNum == 1) {
					this.isLoading = true;
					this.loadingTitle = '加载中...';
				}
				this.queryPramas.productType = this.tabStatus;
				if(this.choseColor) {
					this.queryPramas.color = this.choseColor
				}
				if(this.choseMaterial) {
					this.queryPramas.material = this.choseMaterial
				}
				console.log(this.queryPramas)
				request.GET('/system/products/list/app', this.queryPramas).then(data => {
					// this.productList = data.rows;
					this.productList.push(...data.rows);
					if(this.productList.length == 0) {
						this.loadingTitle = '暂无内容';
					} else {
						this.isLoading = false;
						this.queryPramas.pageNum = +this.queryPramas.pageNum + 1;
					}
				})
			},
			// 顶部导航栏状态改变
			tabChange(tabNum) {
				this.tabStatus = tabNum;
				this.productList = [];
				if(tabNum == '1' || tabNum == '2') {
					this.choseColor = '';
					this.choseMaterial = '';
					this.queryPramas.color = '';
					this.queryPramas.material = '';
					this.queryPramas.pageNum = 1;
					this.getList();
				}
				if(tabNum == '3') {
					this.getDeviceno();
					// // 查询已内容
					// this.findBuy();
					this.data = [];
					loginSystem().then(data => {
						this.token = data;
						this.getActive();
					})
				}
				this.pageSize = 10;
				this.pageNum = 1;
			},
			findBuy() {
				this.isLoading = true;
				this.loadingTitle = '加载中...';
				request.GET(`/system/ordersdetail/findBuy/${this.userInfo.advMembersId}`)
					   .then(response => {
						   console.log(response, "aaa")
						   this.buyList = response.rows;
						   if(this.buyList.length == 0) {
								this.loadingTitle = '暂无内容';
								this.canUpload = false;
						   } else {
								this.isLoading = false;
								for(var i = 0; i < this.buyList.length; i++) {
									if(this.buyList[i].syncFlag == '1') {
										this.canUpload = true;
										this.checkBox.push(this.buyList[i].advProductsId)
									}
								}
						   }
					   })
			},
			// 已购内容展示 全部 还是展示 已上传 
			changeShow(value) {
				this.allOrUpload = value;
			},
			// 已购内容被选中
			changeCheck(e) {
				this.checkBox = e.target.value;
			},
			// 查看设备产品详情
			checkDetails(advProductsId) {
				uni.navigateTo({
					url: '/pages/product/productDetails/productDetails?id='+advProductsId
				})
			},
		
			// 第三个列表需要的方法
			// 资讯数据查询
			getActive() {
				if(this.pageNum > 1) {
					this.isGetMore = true;
				}
				console.log(this.pageNum, "页码", this.pageSize, "大小")
				//  ?pageNum=${this.pageNum}&pageSize=${this.pageSize}
				uni.request({
					url: `${BASE_URL}/system/platinfos/list`,
					method: 'GET',
					data: {
						infoSection: this.type,
						pageNum: this.pageNum,
						pageSize: this.pageSize,
						reasonable: false
					},
					dataType: 'json',
					header: {
						"Content-Type": "application/json;charset=utf-8",
						"Authorization": this.token
					},
					success: (response) => {
						// 如果请求成功，解析响应数据并调用 resolve  
						if (response.data && response.statusCode === 200) { 
							console.log(response.data);
							if(response.data.rows.length == 0) {
								this.bottomNotice = "没有更多了..."
								setTimeout(() => {
									this.isGetMore = false;
								}, 1500)
							} else {
								this.data.push(...response.data.rows);
								this.pageNum = +this.pageNum + 1;
								this.isGetMore = false;
							}
							
						} else {  
							uni.showToast({
								title: '查询失败',
								icon: 'none'
							})
						}
					},
					fail: (error) => {
						uni.showToast({
							title: '查询失败',
							icon: 'none'
						})
					}
				})
			},
			// 跳转到资讯详情
			checkInfo(id) {
				uni.navigateTo({
					url: '/pages/index/informationDetails/informationDetails?id='+id
				})
			}
		},
		watch: {
			checkBox(newValue) {
				this.canUpload = newValue.length != 0;
			}
		}
	}
</script>

<style scoped>
/* .product {
	background-image: url('https://www.metamirror.cn:8085/profile/upload/2024/08/31/bgc_20240831154746A015.jpg');
} */
.title {
	box-sizing: border-box;
	width: 700rpx;
	height: 30px;
	line-height: 30px;
	margin: 10px auto;
	border-left: 5px solid skyblue;
	padding-left: 10px;
	font-weight: bold;
}
.flex-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.flex-row-around {
	display: flex;
	justify-content: space-around;
	align-items: center;
}
.flex-column {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-direction: column;
}
.flex-column-around {
	display: flex;
	justify-content: space-around;
	align-items: center;
	flex-direction: column;
}
.flex-row-graid {
	display: flex;
	justify-content: space-between;
	align-items: center;
	flex-wrap: wrap;
}
.position-center {
	position: absolute;
	left: 50%;
	top: 50%;
	transform: translate(-50%,-50%)
}
.tab-bar-item {
	position: ;
	width: 100%;
	line-height: 30px;
	text-align: center;
	width: 150rpx;
	box-sizing: border-box;
}
.tab-bar-item-active {
	color: skyblue;
	border-bottom: 2px solid skyblue;
}
.product-body {
	width: 750rpx;
	padding: 10px;
	box-sizing: border-box;
}
.left-chose {
	width: 40px;
	height: 40px;
}
.top-icon {
	width: 24px;
	height: 24px;
}
.label {
	width: 100%;
	text-align: center;
	font-size: 10px;
	font-weight: bold;
}
.bottom-button {
	width: 500rpx;
	height: 60px;
	border-radius: 30px;
	background-color: #ccc;
	text-align: center;
	line-height: 60px;
	font-size: 20px;
	font-weight: bold;
	color: white;
	letter-spacing: 5px;
	transition: all .3s;
}
.bottom-button-upload {
	background-color: royalblue;
	box-shadow: 5px 5px 25px -10px black;
}
.status-btn-item {
	width: 200rpx;
	height: 30px;
	border-radius: 5px;
	color: white;
	background-color: black;
	text-align: center;
	line-height: 30px;
	font-weight: bold;
}
.status-btn-item-no {
	width: 200rpx;
	height: 30px;
	border-radius: 5px;
	color: green;
	text-align: center;
	line-height: 30px;
	font-weight: bold;
}
/* 500rpx */
.popup-chose-item {
	box-sizing: border-box;
	width: 100%;
	background-color: white;
	padding: 10px;
	margin: 0 0 10px 0;
	border-radius: 10px;
}
/* 550rpx */
.popup-title {
	box-sizing: border-box;
	width: 450rpx;
	height: 20px;
	font-weight: bold;
	line-height: 20px;
	margin: 0 auto;
}
.popup-chose-type {
	box-sizing: border-box;
	width: 450rpx;
	line-height: 20px;
	margin: 10px auto 0;
	display: flex;
	justify-content: flex-start;
	align-items: center;
	flex-wrap: wrap;
}
.popup-chose-type-item {
	box-sizing: border-box;
	height: 26px;
	padding: 0 20px;
	margin: 0 8px 8px 0;
	background-color: #eee;
	line-height: 26px;
	border-radius: 13px;
	font-size: 14px;
	font-weight: bold;
	color: #ccc;
	transition: all .3s; 
}
.chose-materail{
	background-color: black;
	color: white;
	box-shadow: 0 0 10px 0 #ccc;
}

.chose-color {
	background-color: black;
	color: white;
	box-shadow: 0 0 10px 0 #ccc;
}
.reset-btn, .submit-btn {
	position: relative;
}
.reset-btn::after {
	content: '';
	width: 20px;
	height: 20px;
	position: absolute;
	right: 0;
	bottom: 0;
	background-color: black;
	background-image: radial-gradient(circle at 0 0, #ccc 25px, black 0);
}
.submit-btn::after {
	content: '';
	width: 20px;
	height: 20px;
	position: absolute;
	left: 0;
	top: 0;
	background-color: white;
	background-image: radial-gradient(circle at right bottom, black 25px, #ccc 0);
}
</style>
